package com.zp95sky.cloud.examples.mybatis.controller;

import com.zp95sky.cloud.examples.mybatis.entity.T1;
import com.zp95sky.cloud.examples.mybatis.service.TestService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TestController {

    @Resource
    private TestService testService;

    @GetMapping("/getData")
    public List<T1> getData() {
        return testService.getData();
    }

    @PostMapping("/saveData")
    public String saveData(@RequestBody T1 t1) {
        testService.saveData(t1);
        return "success";
    }

    @GetMapping("/customGetData")
    public List<T1> customGetData() {
        return testService.customGetData();
    }

    @PostMapping("/customSaveData")
    public String customSaveData(@RequestBody T1 t1) {
        testService.customSaveData(t1);
        return "success";
    }

    @GetMapping("/customGetData2")
    public List<T1> customGetData2() {
        return testService.customGetData2();
    }

    @PostMapping("/customSaveData2")
    public String customSaveData2(@RequestBody T1 t1) {
        testService.customSaveData2(t1);
        return "success";
    }

    @GetMapping("/customGetData3")
    public List<T1> customGetData3() {
        return testService.customGetData3();
    }

    @PostMapping("/customSaveData3")
    public String customSaveData3(@RequestBody T1 t1) {
        testService.customSaveData3(t1);
        return "success";
    }

    @GetMapping("/customGetData4")
    public List<T1> customGetData4() {
        return testService.customGetData4();
    }

    @PostMapping("/customSaveData4")
    public String customSaveData4(@RequestBody T1 t1) {
        testService.customSaveData4(t1);
        return "success";
    }

}
